#ifndef IKEYVALUESTORAGE_H_INCLUDED
#define IKEYVALUESTORAGE_H_INCLUDED

#include <string>
#include <exception>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>

namespace Core {

/**
 *
 */
struct KeyValueStorageParams {
	std::size_t preAllocSize; 	   // 
	std::size_t maxSignatureInStorage; // 0 = infinity
};

/**
 *
 */
struct KeyBucket { 
	std::string GUID;
};

/**
 *
 */
class IKeyValueStorage {
public :
	explicit IKeyValueStorage(KeyValueStorageParams const & params) 
		: m_baseParams(params) { }

	virtual ~IKeyValueStorage() { }
	
	virtual void initialize() throw (std::exception) = 0;
	virtual void insert(std::string const & key, KeyBucket const & bucket) = 0;	
	virtual void remove(std::string const & key) = 0;
	
	virtual bool getBucket(std::string const & key, KeyBucket & bucket) = 0;
	virtual bool containsBucket(std::string const & key) = 0;
	virtual void getKey(std::string & key, std::size_t index) = 0;
	virtual std::size_t getKeyCount() = 0;
	virtual void getNextKey(std::string & key) = 0;
	virtual unsigned int getKeyMaxLength() = 0;
	
	KeyValueStorageParams const & getParams() const { return m_baseParams; }

private :
	KeyValueStorageParams const m_baseParams;

};

typedef boost::shared_ptr<IKeyValueStorage> IKeyValueStoragePtr;

} // namespace Core

#endif

